/**
 * @file at24c02.h
 * @author your name (you@domain.com)
 * @brief
 * @version 0.1
 * @date 2022-05-23
 *
 * @copyright Copyright (c) 2022
 *
 */

#ifndef _AT24C02_H_
#define _AT24C02_H_

#include "main.h"
#include "stdio.h"

#define MAZMOD_AT24CXX_7BIT_ADDR        0x50
#define MAZMOD_AT24CXX_8BIT_WADDR       (MAZMOD_AT24CXX_7BIT_ADDR << 1)
#define MAZMOD_AT24CXX_8BIT_RADDR       MAZMOD_AT24CXX_8BIT_WADDR + 1

#define MAZMOD_AT24CXX_TIMEOUT          1000
#define MAZMOD_AT24CXX_PAGESIZE         8
#define MAZMOD_AT24CXX_TOTALSIZE        256

int at24c02_set_current_address(uint8_t address);
int at24c02_byte_write(uint8_t address, uint8_t* buffer);
int at24c02_page_write(uint8_t address, uint8_t* buffer, uint8_t length);
int at24c02_current_address_read(uint8_t* buffer);
int at24c02_random_read(uint8_t address, uint8_t* buffer);
int at24c02_sequential_read(uint8_t* buffer, uint16_t length);
int at24c02_continuous_read(uint8_t address, uint8_t* buffer, uint16_t length);

#endif /* _AT24C02_H_ */
